package youjia;

/**
 * Created with IntelliJ IDEA.
 * ClassName: Exp
 * Package: youjia
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-09
 * Time: 17:28
 */

public class Exp {
    public static boolean solution1(int x) {
        // 4 6 16 是2的n次方 , 15 不是
        if (x == 0 || x == 1) {
            return true;
        }
        while (x > 1) {
            int i = (x % 2 == 0) ? (x /= 2) : (x = 0);
        }
        if (x == 1) {
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        System.out.println(solution1(8));
    }
}
